package com.xju.subjectsystem.config;

import com.xju.subjectsystem.interceptors.TokenInterceptors;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

/**
 * -*- coding:utf-8 -*-
 *
 * @projectName: Subjectsystem
 * @package: com.xju.subjectsystem.config
 * @className: WebConfig
 * @author: Eiard
 * @description: TODO : 拦截器配置
 * @date: 2024-12-08 19:26
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    private final TokenInterceptors tokenInterceptors;

    public WebConfig(TokenInterceptors tokenInterceptors) {
        this.tokenInterceptors = tokenInterceptors;
    }

    /**
     * @methodName: addViewControllers
     * @package: com.xju.subjectsystem.config
     * @description: DONE : 访问/login 路径，返回login.html页面
     * @author: Eiard
     * @date: 2024-12-09 15:06
     * @param: registry
     * @return: void
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/login").setViewName("login.html");
    }

    /**
     * @methodName: addInterceptors
     * @package: com.xju.subjectsystem.config
     * @description: DONE : 添加拦截器
     * @author: Eiard
     * @date: 2024-12-09 15:06
     * @param: registry
     * @return: void
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

//        registry.addInterceptor(tokenInterceptors)
//                .addPathPatterns("/**")
//                .excludePathPatterns("/login");


    }
}
